﻿//************************************************************************************************
// Copyright © 2003-2012 Steven M. Cohn. All Rights Reserved.
//
// Facility:	Microsoft Development Environment 2012  Version 11.0.50727.1
// Environment:	Microsoft .NET Framework 4.5            Version v4.0.30319
//
// Description: Flicker-free and notifiable ListView
//
// Revision History:
// -Who--------------- -When---------- -What------------------------------------------------------
// Steven M. Cohn		18-Oct-2003		New
// Steven M. Cohn		12-Oct-2004		VS.NET 2005, .NET 2.0
// Steven M. Cohn		20-Nov-2012		Refresh! VS2010 .NET 4.5 64-bit
//************************************************************************************************

namespace CookieChipper
{
	using System;
	using System.Windows.Forms;

	
	internal partial class ListViewFF : ListView
	{
		private const int WM_ERASEBKGND = 0x14;


		/// <summary>
		/// 
		/// </summary>

		public ListViewFF ()
			: base()
		{
			InitializeComponent();

			// deal with flickering... activate double buffering and enable message handling
			// so we have a chance to filter out WM_ERASEBKGND
	        this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);
			this.SetStyle(ControlStyles.EnableNotifyMessage, true);
	    }


		/// <summary>
		/// 
		/// </summary>
		/// <param name="m"></param>

		protected override void OnNotifyMessage(Message m)
		{
			if(m.Msg != WM_ERASEBKGND)  // filter it out!
			{
				base.OnNotifyMessage(m);
			}
		}
	}
}
